package com.woniuxy.userdemo.mapper;

import com.woniuxy.userdemo.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    @Select("select * from t_user where username = #{value}")
    User selectUserByName(String name);

    List<User> selectUserByCons(@Param("name") String username, @Param("edu") Integer education);

    @Select("select * from t_user where id = #{id}")
    User selectUserById(int id);

    @Update("update t_user set username=#{username},age=#{age},sex=#{sex},tel=#{tel},education=#{education} where id = #{id}")
    void update(User user);

    @Delete("delete from t_user where id = #{id}")
    void deleteByKey(int id);

    @Insert("insert into t_user(username,password,sex,age,tel,education) values (#{username},#{password},#{sex},#{age},#{tel},#{education})")
    void insert(User user);
}
